/**************************************************************************************
* Component of simpleRTJ regression tests.
**************************************************************************************
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL RTJ COMPUTING BE LIABLE FOR ANY CLAIM, DAMAGES
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Created by:
*       RTJ Computing
**************************************************************************************/
public class TestInstance
{
    int a;

    InnerCl inner;
    public TestInstance()
    {
        a = 10;
    }
    public TestInstance(int a)
    {
        this.a = a;
    }

    public TestInstance(int a, int b)
    {
        this.a = a;
        inner = new InnerCl();
    }

    public int a()
    {
        return 15;
    }


    public class InnerCl
    {
        int a;
        public InnerCl()
        {
            this.a = TestInstance.this.a;
            TestInstance.this.a = 20;
        }
    }

    public static void test() throws Exception
    {
        if (new TestInstance().a != 10) throw new Exception("INS1");
        if (new TestInstance(11).a != 11) throw new Exception("INS2");
        if (new TestInstance(9, 0).a != 20) throw new Exception("INS3");
        if (new TestInstance(9, 0).inner.a != 9) throw new Exception("INS4");
        if (new TestInstance().a() != 15) throw new Exception("INS5");
    }
}
